.section .text at 0:
    .global _start
_start:
    set     r0,@.data                                                 #prepare address for output
    set     r1,58                                                     #prepare length for output
    set     r3,1                                                      #prepare mode for output
    .global _loop
_loop:
    load    r4,1,r0+0                                                     #load 1 byte from string
    write   r4,1,3                                                        #write 1 byte to output
    calc    r0,r0,r3,add                                                  #increment address
    calc    r1,r1,r3,sub                                                  #decrement length
    jmp     r1,ne,@_loop                                                  #jump to loop if length is not zero
    write   r3,1,2                                                        #write 1 byte to output control
    read    r3,1,2                                                        #read 1 byte from output control
    jmp     r3,ne,-2
#wait until output done
    halt

.section .data at 0x200:
    .string _hello 0x200 "Hello,world!\nIf you see this,the system is working well.\n"